package dubbo.learning.sb.sample.consumer.controller;

import dubbo.learning.sample.api.action.TestAction;
import dubbo.learning.sample.api.service.TestService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目名称：dubbo-learning
 * 类名称：DefaultTestService
 * 类描述：DefaultTestService
 * 创建时间：2020/12/14
 *
 * @author jiangjunjie   (E-mail:jiangjunjie@foursmile001.com)
 * @version v1.0
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @DubboReference(registry = {"shanghai", "hunan"}, version = "1.0.0")
    private TestService testService;

    @GetMapping()
    public String create() {
        TestAction action = new TestAction();
        action.setStr("foo");
        String result = testService.create(action);
        return result;
    }

}



